home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / packet / p_tapr / tnchst / dlc.doc (.txt) < prev    next >
WordStar Document  |  1992-03-16  |  16KB  |  305 lines

  1.  
  2.  
  3.  Document dedicated to the public domain by N2WX
  4.  Retention of authorship notice would not be inappropriate
  5.  
  6.  
  7.  
  8. WARNING - EXPERIMENTERS ONLY!
  9.  
  10.     Host mode on TNC-2 and derivative TNCs at this time remains experimental.  Obvious features received a quick "going over" and rather cursory debug, but discovery of the remaining inevitable bugs and critical programming oversights awaits the adventurous reader/developer.  Please direct discoveries and criticisms:
  11.  
  12.         via slow boat : to Howard Goldstein
  13.                         5201-23rd Ave. N.
  14.                         St. Petersburg, FL 33710 USA
  15.         via compuserv : to 75006,702
  16.         via ham packet: to N2WX @ W4DPH.FL
  17.  
  18. 1    Introduction
  19.  
  20.     This document describes the data-link control protocol (DLC) used by the TNC-2 terminal node controller on its RS-232 line.  
  21.  
  22. 1.1    Where it fits in
  23.  
  24.     DLC  provides a bidirectional error-protected two-way queue, for BLP (the binary interface protocol).  DLC uses the underlying QAFT physical layer driver as its transmission medium.  
  25.  
  26.  
  27.         |                 |
  28.         |  Application    |
  29.         |(transport intfc)|                             ^~~~~<> RF to peer
  30.         +++++++++++++++++++                     ________|________
  31.         |                 |                    |                 |      
  32.         |                 |                    |                 |      
  33.         | Computer driver |                    |    TNC driver   |      
  34.         | (network intfc) |                    | (network intfc) |      
  35.         |                 |                    |                 |      
  36.     ----------------------------           ---------------------------- 
  37.         Binary Link Protocol     |*******|     Binary Link Protocol     
  38.        (defined elsewhere        |       |     (defined elsewhere)
  39.    +----------------------------+         +----------------------------+
  40.    |                            |         |                            |
  41.    |                            |         |                            |
  42.    |           DLC              |*********|            DLC             |
  43.    |        (defined here)      |         |    (defined here)          |
  44.    +----------------------------+         +----------------------------+
  45.    |          QAFT              |         |          QAFT              |
  46.    |    (defined elsewhere)     |.........|    (defined elsewhere)     |
  47.    |                            |         |                            |
  48.    +----------------------------+         +----------------------------+
  49.  
  50.                         Key:
  51.                             ....  One connection
  52.                             ******  One or more logical connections
  53.  
  54.  
  55. 1.1.1    DLC encapsulation
  56.  
  57.     The DLC interface communicates with its peer interface by transceiving DLC packets using QAFT services along the underlying QAFT link.
  58.  
  59. 1.1.2    DLC packet structure
  60.  
  61. >| DESTINATIONbyte | SOURCEbyte | CTRLbyte | [variable per CTRL] |<
  62.  
  63.     byte    ::  8 bit unsigned integer
  64.  
  65. DESTINATION
  66. SOURCE    : Physical address of the sending (SOURCE) and sinking (DESTINATION) DLC devices for this DLC packet.  <Optional in TNC-2>
  67.  
  68. CTRL    :  type of packet 
  69.  
  70.     The high nibble of the control byte contains the DLC packet type.  Values in the low nibble are sequence numbers.
  71.  
  72. hex
  73. ---
  74. 10    RESET    - Link restart                     (request)
  75. 20    RESET_ACK    - Link restarted                     (response)
  76.  
  77. 4x    DATA        - Sequenced data                     (request)
  78.                 (x := mod 16 sequence # of data)
  79.  
  80. 5x    DACK        - Sequenced data acknowledgement        (response)
  81.                 (x := mod 16 acknowledges up through seq # x-1)
  82.  
  83. 2    Defining DLC
  84.  
  85.     DLC is a balanced protocol.  Since there are no master-slave relationships, any one DLC device can communicate with any other electrically connected DLC device.  (for ex., one computer-one TNC, or two computers and no TNCs, or two TNCs back-to-back).  Note however that the current TNC-2 implementation does not specify source/destination addressing, therefore only one DLC link may take place across the physical medium.
  86.  
  87.     DLC is described and was implemented as an event-driven finite-state machine.  
  88.  
  89. 2.1    DLC Objects
  90.  
  91.     Each DLC link uses these variables and objects:
  92.  
  93. DLSTATE:    One of n states. (see section on DLC states, below)
  94.  
  95. DQUEUE:    FIFO queue of packets as yet unacknowledged by the peer DLC device.
  96.  
  97.  
  98. 2.2    DLC States
  99.  
  100.     Four states and seven events are defined.  See the appendix for the state tables.
  101.  
  102. 2.2.1    States
  103.  
  104. 2.2.1.1    DLIDLE
  105.  
  106.     The DLC link is now inactive and awaits either (1) receipt of a link reset (RESET) packet; or (2) local command to initiate an outgoing call from the upper-level BLP driver.
  107.  
  108.     If the DLC machine receives RESET, the DLC driver shall respond with a reset-acknowledged (RESET_ACK) packet and reset all of its upper level BLP links.
  109.  
  110. 2.2.1.2    DLRESET
  111.  
  112.     The DLC machine enters this state when a local event occurs (ex: upper-level BLP attempts to place a call, or a datagram is received).  When the BTIMER-expired event occurs, the machine in this state sends a RESET packet to the peer.
  113.  
  114.     The DLC machine leaves this state and is ready for data transfer when a reset-acknowledged (RESET_ACK) or another RESETindication is received.
  115.  
  116. 2.2.1.3    DLDATA
  117.  
  118.     
  119.  
  120.  Document dedicated to the public domain by N2WX
  121.  Retention of authorship notice would not be inappropriate
  122.  
  123.  
  124.  
  125. WARNING - EXPERIMENTERS ONLY!
  126.  
  127.     Host mode on TNC-2 and derivative TNCs at this time remains experimental.  Obvious features received a quick "going over" and rather cursory debug, but discovery of the remaining inevitable bugs and critical programming oversights awaits the adventurous reader/developer.  Please direct discoveries and criticisms:
  128.  
  129.         via slow boat : to Howard Goldstein
  130.                         5201-23rd Ave. N.
  131.                         St. Petersburg, FL 33710 USA
  132.         via compuserv : to 75006,702
  133.         via ham packet: to N2WX @ W4DPH.FL
  134.  
  135. 1    Introduction
  136.  
  137.     This document describes the data-link control protocol (DLC) used by the TNC-2 terminal node controller on its RS-232 line.  
  138.  
  139. 1.1    Where it fits in
  140.  
  141.     DLC  provides a bidirectional error-protected two-way queue, for BLP (the binary interface protocol).  DLC uses the underlying QAFT physical layer driver as its transmission medium.  
  142.  
  143.  
  144.         |                 |
  145.         |  Application    |
  146.         |(transport intfc)|                             ^~~~~<> RF to peer
  147.         +++++++++++++++++++                     ________|________
  148.         |                 |                    |                 |      
  149.         |                 |                    |                 |      
  150.         | Computer driver |                    |    TNC driver   |      
  151.         | (network intfc) |                    | (network intfc) |      
  152.         |                 |                    |                 |      
  153.     ----------------------------           ---------------------------- 
  154.         Binary Link Protocol     |*******|     Binary Link Protocol     
  155.        (defined elsewhere        |       |     (defined elsewhere)
  156.    +----------------------------+         +----------------------------+
  157.    |                            |         |                            |
  158.    |                            |         |                            |
  159.    |           DLC              |*********|            DLC             |
  160.    |        (defined here)      |         |    (defined here)          |
  161.    +----------------------------+         +----------------------------+
  162.    |          QAFT              |         |          QAFT              |
  163.    |    (defined elsewhere)     |.........|    (defined elsewhere)     |
  164.    |                            |         |                            |
  165.    +----------------------------+         +----------------------------+
  166.  
  167.                         Key:
  168.                             ....  One connection
  169.                             ******  One or more logical connections
  170.  
  171.  
  172. 1.1.1    DLC encapsulation
  173.  
  174.     The DLC interface communicates with its peer interface by transceiving DLC packets using QAFT services along the underlying QAFT link.
  175.  
  176. 1.1.2    DLC packet structure
  177.  
  178. >| DESTINATIONbyte | SOURCEbyte | CTRLbyte | [variable per CTRL] |<
  179.  
  180.     byte    ::  8 bit unsigned integer
  181.  
  182. DESTINATION
  183. SOURCE    : Physical address of the sending (SOURCE) and sinking (DESTINATION) DLC devices for this DLC packet.  <Optional in TNC-2>
  184.  
  185. CTRL    :  type of packet 
  186.  
  187.     The high nibble of the control byte contains the DLC packet type.  Values in the low nibble are sequence numbers.
  188.  
  189. hex
  190. ---
  191. 10    RESET    - Link restart                     (request)
  192. 20    RESET_ACK    - Link restarted                     (response)
  193.  
  194. 4x    DATA        - Sequenced data                     (request)
  195.                 (x := mod 16 sequence # of data)
  196.  
  197. 5x    DACK        - Sequenced data acknowledgement        (response)
  198.                 (x := mod 16 acknowledges up through seq # x-1)
  199.  
  200. 2    Defining DLC
  201.  
  202.     DLC is a balanced protocol.  Since there are no master-slave relationships, any one DLC device can communicate with any other electrically connected DLC device.  (for ex., one computer-one TNC, or two computers and no TNCs, or two TNCs back-to-back).  Note however that the current TNC-2 implementation does not specify source/destination addressing, therefore only one DLC link may take place across the physical medium.
  203.  
  204.     DLC is described and was implemented as an event-driven finite-state machine.  
  205.  
  206. 2.1    DLC Objects
  207.  
  208.     Each DLC link uses these variables and objects:
  209.  
  210. DLSTATE:    One of n states. (see section on DLC states, below)
  211.  
  212. DQUEUE:    FIFO queue of packets as yet unacknowledged by the peer DLC device.
  213.  
  214.  
  215. 2.2    DLC States
  216.  
  217.     Four states and seven events are defined.  See the appendix for the state tables.
  218.  
  219. 2.2.1    States
  220.  
  221. 2.2.1.1    DLIDLE
  222.  
  223.     The DLC link is now inactive and awaits either (1) receipt of a link reset (RESET) packet; or (2) local command to initiate an outgoing call from the upper-level BLP driver.
  224.  
  225.     If the DLC machine receives RESET, the DLC driver shall respond with a reset-acknowledged (RESET_ACK) packet and reset all of its upper level BLP links.
  226.  
  227. 2.2.1.2    DLRESET
  228.  
  229.     The DLC machine enters this state when a local event occurs (ex: upper-level BLP attempts to place a call, or a datagram is received).  When the BTIMER-expired event occurs, the machine in this state sends a RESET packet to the peer.
  230.  
  231.     The DLC machine leaves this state and is ready for data transfer when a reset-acknowledged (RESET_ACK) or another RESETindication is received.
  232.  
  233. 2.2.1.3    DLDATA
  234.  
  235.     Local and peer DLCs are ready to transact.  The state changes to DWAIT when new outgoing sequenced data packets are enqueued.  DDATA state is reentered once all outstanding packets are acknowledged.
  236.  
  237. 2.2.1.4    DLDWAIT
  238.  
  239.     The DLC machine has data outstanding for the remote DLC, and is awaiting a response.  If a BTIMER-expired event occurs, the data packet(s) is (are) retransmitted.  If a DACK packet acknowledging all outstanding packets is received, the state changes to DDATA.
  240.  
  241.  
  242. 2.3    DLC packet types
  243.  
  244. 2.3.1    RESET - Call setup
  245.  
  246.     format:
  247.         |DESTINATION|SOURCE|10|
  248.           ^^^^^^^^^^^^^^^
  249.              (optional)
  250.  
  251.     If the DLC link is idle, one side will transmit a RESET packet to fix both sides of the link to a known (DLDATA) state.
  252.  
  253.     When a device receives a RESET packet it shall reply with a RESET_ACK packet and reset all of the BLP circuits its associated with.
  254.  
  255. 2.3.2    RESET_ACK - DLC resetted
  256.  
  257.     format:
  258.         |DESTINATION|SOURCE|LCN|20|
  259.           ^^^^^^^^^^^^^^^
  260.              (optional)
  261.  
  262.  
  263.     Receipt of the RESET_ACK packet indicates that the DLC link is successfully opened and BLP may begin using the link.
  264.  
  265. 2.3.3    DLDATA - Sequenced data command packet
  266.  
  267.     format:
  268.         |DESTINATION|SOURCE|4x|[data0...datan]|
  269.         ^^^^^^^^^^^^^^^
  270.              (optional)
  271.  
  272.             x ::     sequence number, mod 16
  273.  
  274. 2.3.3.1    DACK  - Sequenced data acknowledgement
  275.  
  276.     format:
  277.         |DESTINATION|SOURCE|5x|
  278.         ^^^^^^^^^^^^^^^
  279.              (optional)
  280.             x ::     sequence number, mod 16
  281.  
  282.     Acknowledges packets through sequence number 'x'
  283.  
  284.  
  285. DLC State table
  286.                   rx DACK, all
  287.     | rx RESET    |rx RESET_ACK    |rx DATA    |  acknowledged    |  timer xpd    |new data queued    | Local start
  288. ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
  289.     |Reset BLP,clr queues    |    |    |    |    |    | state>DLRESET
  290. DLIDLE    |send RESET_ACK,    |    |    |    |    |    |
  291.     |state>DLDATA    |    |    |    |    |    |
  292. ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
  293.     |     "    |    |    |    |    |    |
  294. DLRESET    |    |state>DLDATA    |    |    |send RESET pkt    |    |
  295.     |    |    |    |    |    |    |
  296. ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
  297.     |     "    |    |    |    |    |    |    |
  298. DLDATA    |    |    |send DACK    |    |    |state>DLDWAIT    |
  299.     |    |    |    |    |    |    |
  300. ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
  301.     |     "    |    |    |    |    |    |
  302. DLDWAIT    |    |    |send DACK    | state>DLDATA    |send all DLDATA    |    |
  303.     |    |    |    |    |    |    |
  304. ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
  305.